const { NacosConfigClient } = require("nacos");
function nacos() {
  console.log("连接");
  const nacosClient = new NacosConfigClient({
    serverAddr: process.env.NACOS_ADDR, // 'nacos.cn.xyb2b.cn',
    ssl: process.env.NACOS_SSL,
    namespace: process.env.NACOS_NAMESPACE,
    serverPort: process.env.NACOS_PORT,
  });

  return async (ctx, next) => {
    ctx.nacosClient = nacosClient;
    await next();
  };
}
module.exports = nacos;
